﻿@model IEnumerable<Domain.Answer>
@using CantinhodaCegonha.Models.Helpers

@{
    ViewBag.Title = "Index";
}

<h2>Index</h2>

<p>
    @Html.ActionLink("Create New", "Create")
</p>
<table>
    <tr>
        <th>
            Text
        </th>
        <th>
            Votes
        </th>
        <th>
            DateCreated
        </th>
        <th>
            Question
        </th>
        <th>
            User
        </th>
        <th></th>
    </tr>

@foreach (var item in Model)
{
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.Text)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Votes)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.DateCreated)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Question.Title)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.User.Email)
        </td>
        <td>
            @Html.ActionLink("Edit", "Edit", new { id = item.Id }) |
            @Html.ActionLink("Details", "Details", new { id = item.Id }) |
            @Html.ActionLink("Delete", "Delete", new { id = item.Id })
        </td>
    </tr>
}

</table>

<ul class="hfeed">
	@if (Model.Count() == 0)
 { 
	   <h5>Ainda não existem comentários. Seja o primeiro a comentar!</h5>
 } 
        @foreach (var item in Model)
        { 
		<li class="quote hentry">
			<div class="activity" style="width: 362px;">
				<p class="author vcard">
					@Html.ActionLink(item.User.Nome, "UserDetails", "Account", new { id = item.UserId },null) 
					<span class="caixaImg"></span>
                    @Html.ImageLink("UserDetails", "Account", item.User.Foto, "Imagem", new { id =item.UserId }, new { @class = "imgComment" }, new { width = "48px", height = "48px" })
					escreveu:<span style="float: right">@item.DateCreated.ToLocalTime() </span>
				</p>
				<blockquote class="entry-content">
					<p>
						@item.Text 
					</p>
				</blockquote>
				<span class="b"></span>
			</div>
		</li>
		} 
	</ul>